package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	student := &Student{100, "20200010001"}
	bytes, e := json.Marshal(student)
	if e != nil {
		fmt.Println("change to json fail.", e)
		return
	}
	fmt.Printf("json is %s\n", bytes)
	js := "{\"Id\":200, \"StuNo\":\"20200020001\"}"
	var stu Student
	json.Unmarshal([]byte(js), &stu)
	fmt.Println(stu)
}

type Student struct {
	Id int32
	StuNo string
}